home *** CD-ROM | disk | FTP | other *** search
- Path: morse.ukonline.co.uk!usenet
- From: g.tafuro@ukonline.co.uk
- Newsgroups: comp.lang.c++
- Subject: Re: Help me please
- Date: 21 Mar 1996 15:06:46 GMT
- Organization: UK Online
- Message-ID: <4irra6$g7u@morse.ukonline.co.uk>
- References: <9MGBMHAUirSxEwbi@waichung.demon.co.uk>
- NNTP-Posting-Host: wwwproxy.ukonline.co.uk
-
- There is nothing wrong building a structure as the one you shown in the
- message.
- However that is not an object oriented way of doing that.
-
- I would rather create a proper class (with private data members, default
- constructor, destructor, copy constructor, assignment operator, etc.) that
- would contain all the operations (functions) required.
-
- Also I would create an abstract class (let's say TreeType) from which I
- would derive my BTree class. Doing this you would create your standard for
- declaring objects that are trees (no matter if binary or not).
-
- If you create a BTree class then you should also create an iterator that
- would be able to walk the entire b-tree and return all the data contained
- in the b-tree.
- Generally, iterators are used only for browsing not to write on the object
- of the iteration.
- Your printing procedure then would be implemented using the b-tree iterator.
-
- I am sure that you can find many examples of OO binary trees on many books
- on OO techniques.
- As you now using C++, you should try to implement your programs in an OO
- way.
-
- Hope this helps.
-
- Gabriele Tafuro
- g.tafuro@ukonline.co.uk
-